/**
** File Name="treecontrol.h"
** Header file for treecontrol
** Created by Frank
** on 2011/08/08
**
**
*/

#pragma once
#ifndef _TREE_CONTROL_H_
#define _TREE_CONTROL_H_

#include <commctrl.h>

class JkTreeCtrl
{
public: //member functions
	JkTreeCtrl(HWND h);
	~JkTreeCtrl();
	
	// message handlers
	LRESULT OnCreate(WPARAM wParam, LPARAM lParam);


public: //static
	//static wnd proc
	static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
	
	//register this window class
	static void RegisterJkTreeCtrl();

	//Create this control helper functionsc
	static HWND CreateJkTreeCtrl(HWND hwnd);
	static HWND CreateJkTreeCtrl(HWND hwnd, int x, int y, int w, int h);

	static JkTreeCtrl* GetJkTreeCtrl(HWND hwnd);
	static void SetJkTreeCtrl(JkTreeCtrl *ccp);

private:
	HWND			hParentWnd;

	HWND			hTree;
	TV_ITEM			tvi;
	HTREEITEM		Selected;
	TV_INSERTSTRUCT tvinsert;   // struct to config out tree control
	HTREEITEM		Parent;           // Tree item handle
	HTREEITEM		Before;           // .......
	HTREEITEM		Root;             // .......
	HIMAGELIST		hImageList;      // Image list array hadle
	HBITMAP			hBitMap;            // bitmap handler
	bool			flagSelected;

public :
	HWND hwnd; // The control's window handle

//static fields
private:
	static TCHAR szClassName[];

};

#endif

